package com.led.datatype;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;

import net.sf.json.JSONObject;

public class DataReal {
	public static int IDX_DATAS = 1;
	
	String datas;

	public String toJsonStr(){
		JSONObject js = new JSONObject();
		js.put("datas", datas);
		return js.toString();
	}

	public DataReal() {
		
	}
	public DataReal(JSONObject js) {
		datas = js.getString("datas");
	}
	
	@Override
	public String toString() {
		return toJsonStr();
	}
	
	public static LinkedList<DataReal> getDatas(ResultSet rs){
		LinkedList<DataReal> loadDatas = new LinkedList<DataReal>();
		if(null == rs){
			return loadDatas;
		}
		
		try {
			while(rs.next()){
				DataReal data = new DataReal();
				data.datas = rs.getString(IDX_DATAS);
				loadDatas.add(data);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		return loadDatas;
	}
	
}
